package guoanmaker.operator.business.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import guoanmaker.operator.business.model.AppOutServerClass;
import guoanmaker.operator.business.model.OperatorCommonServiceDownNew;
import guoanmaker.operator.business.model.OperatorCommonServiceNewRound;
import guoanmaker.operator.business.model.OperatorCompanyDevelopServer;
import guoanmaker.operator.business.model.OperatorCompanyServiceDownNew;
import guoanmaker.operator.business.model.OperatorCompanyServiceNew;
import guoanmaker.operator.business.model.OperatorCompanyServiceNewRound;
import guoanmaker.operator.business.model.OperatorEventDetails;
import guoanmaker.operator.business.model.OperatorFinancingServiceDownNew;
import guoanmaker.operator.business.model.OperatorFinancingServiceNew;
import guoanmaker.operator.business.model.OperatorFriendshipLink;
import guoanmaker.operator.business.model.OperatorHotBusiness;
import guoanmaker.operator.business.model.OperatorHotServerPc;
import guoanmaker.operator.business.model.OperatorHotwords;
import guoanmaker.operator.business.model.OperatorLeaseSpaceNew;
import guoanmaker.operator.business.model.OperatorOfficeSpace;
import guoanmaker.operator.business.model.OperatorPcActive;
import guoanmaker.operator.business.model.OperatorPcCompanyDevelop;
import guoanmaker.operator.business.model.OperatorRoundPhoto;
import guoanmaker.operator.business.model.OperatorServerClass;
import guoanmaker.operator.business.model.PctwoServerClass;
import guoanmaker.operator.business.model.PersonalFinanceProject;
import guoanmaker.operator.business.model.PersonalInvestorDisplay;
import guoanmaker.operator.business.model.ProvideCommodityServiceRange;
import guoanmaker.operator.business.model.ProvideRoom;
import guoanmaker.operator.business.modelnobind.HotBusinessVO;
import guoanmaker.operator.business.modelnobind.OperatorCommodityRo;
import guoanmaker.operator.business.modelnobind.OperatorCompanyServiceVO;
import guoanmaker.operator.business.modelnobind.OperatorFinancingServiceNewVO;
import guoanmaker.operator.business.modelnobind.OperatorOfficeSpaceRo;
import guoanmaker.operator.business.modelnobind.OperatorPcActiveRo;
import guoanmaker.operator.business.modelnobind.PersonalFinanceProjectRo;
import guoanmaker.operator.business.repository.OperatorCommonServiceDownNewRepository;
import guoanmaker.operator.business.repository.OperatorCommonServiceNewRepository;
import guoanmaker.operator.business.repository.OperatorCompanyDevelopServerRepository;
import guoanmaker.operator.business.repository.OperatorCompanyServiceDownNewRepository;
import guoanmaker.operator.business.repository.OperatorCompanyServiceNewRepository;
import guoanmaker.operator.business.repository.OperatorEventDetailsRepository;
import guoanmaker.operator.business.repository.OperatorFinancingServiceDownNewRepository;
import guoanmaker.operator.business.repository.OperatorFinancingServiceNewRepository;
import guoanmaker.operator.business.repository.OperatorFriendshipLinkRepository;
import guoanmaker.operator.business.repository.OperatorHotBusinessRepository;
import guoanmaker.operator.business.repository.OperatorHotwordsRepository;
import guoanmaker.operator.business.repository.OperatorLeaseSpaceNewRepository;
import guoanmaker.operator.business.repository.OperatorOfficeSpaceRepository;
import guoanmaker.operator.business.repository.OperatorPcActiveRepository;
import guoanmaker.operator.business.repository.OperatorPcCompanyDevelopRepository;
import guoanmaker.operator.business.repository.OperatorRoomRepository;
import guoanmaker.operator.business.repository.OperatorRoundPhotoRepository;
import guoanmaker.operator.business.repository.OperatorServerClassRepository;
import guoanmaker.operator.business.repository.OperatorWelcomesRepository;
import guoanmaker.operator.business.repository.PersonalFinanceProjectRepository;
import guoanmaker.operator.business.repository.PersonalInvestorDisplayRepository;
import guoanmaker.operator.business.repository.ProvideCommodityRepository;
import guoanmaker.operator.business.repository.ProvideCommodityServiceRangeRepository;
import guoanmaker.operator.business.repository.ProviderBusinessRepository;

@Service
public class OperatoroOficialService implements OperatoroOficialSeviceInterface {
	@Autowired
	private OperatorHotwordsRepository operatorHotwordsRepository;
	@Autowired
	private OperatorRoundPhotoRepository operatorRoundPhotoRepository;
	@Autowired
	private OperatorWelcomesRepository operatorWelcomesRepository;
	@Autowired
	private OperatorServerClassRepository operatorServerClassRepository;
	@Autowired
	private OperatorOfficeSpaceRepository operatorOfficeSpaceRepository;
	@Autowired
	private OperatorRoomRepository operatorRoomRepository;
	@Autowired
	private OperatorCompanyDevelopServerRepository operatorCompanyDevelopServerRepository;
	@Autowired
	private OperatorPcCompanyDevelopRepository operatorPcCompanyDevelopRepository;
	@Autowired
	private OperatorPcActiveRepository operatorPcActiveRepository;
	@Autowired
	private OperatorEventDetailsRepository operatorEventDetailsRepository;
	@Autowired
	private OperatorHotBusinessRepository operatorHotBusinessRepository;
	@Autowired
	private ProviderBusinessRepository providerBusinessRepository;
	@Autowired
	private OperatorFriendshipLinkRepository operatorFriendshipLinkRepository;
	@Autowired
	private OperatorCommonServiceNewRepository operatorCommonServiceNewRepository;
	@Autowired
	private OperatorCommonServiceDownNewRepository operatorCommonServiceDownNewRepository;
	@Autowired
	private OperatorLeaseSpaceNewRepository operatorLeaseSpaceNewRepository;
	@Autowired
	private OperatorCompanyServiceNewRepository operatorCompanyServiceNewRepository;
	@Autowired
	private OperatorCompanyServiceDownNewRepository operatorCompanyServiceDownNewRepository;
	@Autowired
	private OperatorFinancingServiceNewRepository operatorFinancingServiceNewRepository;
	@Autowired
	private OperatorFinancingServiceDownNewRepository operatorFinancingServiceDownNewRepository;
	@Autowired
	OperatorCommonServiceNewServiceInterface operatorCommonServiceNewServiceInterface;
	@Autowired
	private OperatorCompanyServiceNewServiceInterface operatorCompanyServiceNewServiceInterface;
	@Autowired
	private ProvideCommodityRepository provideCommodityRepository;
	@Autowired
	private OperatorHotServerPcServiceIntegerface operatorHotServerPcServiceIntegerface;
	@Autowired
	private PersonalInvestorDisplayRepository personalInvestorDisplayRepository;
	@Autowired
	private PersonalFinanceProjectRepository personalFinanceProjectRepository;
	@Autowired
	private ProvideCommodityServiceRangeRepository provideCommodityServiceRangeRepository;
	@PersistenceContext
	private EntityManager manager;

	@Override
	public Map getAllpc(String cityId) {
		Map<String, Object> reMap = new HashMap<>();
		// TODO Auto-generated method stub
		/*
		 * List<OperatorWelcomes>
		 * OperatorWelcomeses=operatorWelcomesRepository.findAll();
		 * if(OperatorWelcomeses.size()>0){ reMap.put("OperatorWelcomeses",
		 * OperatorWelcomeses.get(0));}
		 */
		// 搜索栏
		OperatorHotwords operatorHotwords = operatorHotwordsRepository.findPcByCityCodeOne(cityId);
		reMap.put("hot", operatorHotwords);
		List<OperatorHotwords> hots = operatorHotwordsRepository.findPcByCityCodetwo(cityId);
		reMap.put("hots", hots);
		// 轮播图
		List<OperatorRoundPhoto> OperatorRoundPhotos = operatorRoundPhotoRepository.findBycityCode(cityId);
		// System.out.println(OperatorRoundPhotos.size()+"轮播图数量");
		reMap.put("OperatorRoundPhotos", OperatorRoundPhotos);
		// 旧版租赁空间
		List<OperatorOfficeSpaceRo> OperatorOfficeSpaceRos = new ArrayList<OperatorOfficeSpaceRo>();
		List<OperatorOfficeSpace> officeSpaces = operatorOfficeSpaceRepository.getOperatorOfficeSpace(cityId);
		if (officeSpaces.size() > 0) {
			for (OperatorOfficeSpace office : officeSpaces) {
				OperatorOfficeSpaceRo ofro = new OperatorOfficeSpaceRo();
				ProvideRoom pr = operatorRoomRepository.findByroomCodes(office.getRoomCode());
				if (pr != null) {
					ofro.setRoomCode(office.getRoomCode());
					ofro.setPicture(pr.getRoomlogo());
					ofro.setDetailss(pr.getDescribeAsk());
					ofro.setRoomName(pr.getRoomName());
					OperatorOfficeSpaceRos.add(ofro);
				}
			}
		}
		reMap.put("OperatorOfficeSpaceRos", OperatorOfficeSpaceRos);

		// 企业发展
		List<OperatorPcCompanyDevelop> opds = operatorPcCompanyDevelopRepository.getOperatorPcCompanyDevelops(cityId);
		if (opds.size() > 0) {
			for (OperatorPcCompanyDevelop opd : opds) {
				OperatorCompanyDevelopServer[] depservers = operatorCompanyDevelopServerRepository
						.getOperatorCompanyDevelopServers(opd.getId());
				for (OperatorCompanyDevelopServer depserver : depservers) {
					OperatorServerClass operatorServerClass = operatorServerClassRepository
							.findOne(depserver.getTrueServerId());
					if (null != operatorServerClass) {
						depserver.setServerName(operatorServerClass.getServerName());
						depserver.setServerPic(operatorServerClass.getServerPicUrl());
					}

				}
				opd.setOperatorCompanyDevelopServers(depservers);
			}
		}
		reMap.put("opdevelop", opds);

		// 活动
		List<OperatorPcActive> pcActives = operatorPcActiveRepository.getOperatorPcActive(cityId);
		List<OperatorPcActiveRo> pcActiveRos = new ArrayList<OperatorPcActiveRo>();
		if (pcActives.size() > 0) {
			for (OperatorPcActive pcActive : pcActives) {
				OperatorPcActiveRo active = new OperatorPcActiveRo();
				OperatorEventDetails operatorEventDetails = operatorEventDetailsRepository
						.getSelectEventByid(pcActive.getActiveId());
				if (null != operatorEventDetails && !operatorEventDetails.equals("")) {
					active.setActiveid(pcActive.getActiveId());
					active.setActiveName(operatorEventDetails.getEventTitle());
					active.setIsMoney(operatorEventDetails.getIsMoney());
					active.setPicture(operatorEventDetails.getEventPicUrl());
					active.setStartDate(operatorEventDetails.getEventStartTime());
					pcActiveRos.add(active);
				}
			}
		}
		reMap.put("pcActiveRos", pcActiveRos);

		// PC 热门商户
		List<OperatorHotBusiness> hotbusinessList = operatorHotBusinessRepository.getOperatorHotBusiness(cityId);
		List<HotBusinessVO> hotBusinessVOs = new ArrayList<>();
		for (OperatorHotBusiness operatorHotBusiness : hotbusinessList) {
			String jpql = "select new guoanmaker.operator.business.modelnobind.HotBusinessVO(b.id,b.companyLogo,b.businessName,b.introduce,p.followNum) from "
					+ "ProvideShop  p left join p.providerBusiness b inner join b.personalUser u where u.isProvider=2 and  b.busNumber =:busNumber";
			Query query = manager.createQuery(jpql);
			query.setParameter("busNumber", operatorHotBusiness.getBusNumber());
			List<HotBusinessVO> businesss = query.getResultList();
			if (businesss != null && businesss.size() > 0) {
				HotBusinessVO hotBusinessVO = businesss.get(0);
				// hotBusinessVO.setBusinesspicture(operatorHotBusiness.getBusPicture());
				hotBusinessVOs.add(hotBusinessVO);
			}
		}
		reMap.put("hotBusinessVOs", hotBusinessVOs);

		List<OperatorFriendshipLink> friendshiplinks = operatorFriendshipLinkRepository.findByType("1");
		reMap.put("friendshiplinks", friendshiplinks);
		List<AppOutServerClass> appsBusinessService = new ArrayList();// 企业服务
		List<OperatorServerClass> ServerClassList = operatorServerClassRepository.findListBypcNavigation("1");
		for (OperatorServerClass ser : ServerClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			appsBusinessService.add(appOutServerClass);
		}
		reMap.put("appsBusinessService", appsBusinessService);
		List<AppOutServerClass> appsknowledgeService = new ArrayList();// 知识产权服务
		List<OperatorServerClass> ServerknowledgeClassList = operatorServerClassRepository.findListBypcNavigation("2");
		for (OperatorServerClass ser : ServerknowledgeClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			appsknowledgeService.add(appOutServerClass);
		}
		reMap.put("appsknowledgeService", appsknowledgeService);
		List<AppOutServerClass> appstrainService = new ArrayList();// 培训服务
		List<OperatorServerClass> ServertrainClassList = operatorServerClassRepository.findListBypcNavigation("3");
		for (OperatorServerClass ser : ServertrainClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			appstrainService.add(appOutServerClass);
		}
		reMap.put("appstrainService", appstrainService);
		List<AppOutServerClass> appsspaceService = new ArrayList();// 空间服务
		List<OperatorServerClass> ServerspaceClassList = operatorServerClassRepository.findListBypcNavigation("5");
		for (OperatorServerClass ser : ServerspaceClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			appsspaceService.add(appOutServerClass);
		}
		reMap.put("appsspaceService", appsspaceService);

		List<AppOutServerClass> appcollaborateService = new ArrayList();// 大企业合作
		List<OperatorServerClass> collaborateClassList = operatorServerClassRepository.findListBypcNavigation("4");
		for (OperatorServerClass ser : collaborateClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			appcollaborateService.add(appOutServerClass);
		}
		reMap.put("appcollaborateService", appcollaborateService);

		// -------------------------------------------------------------------------------------------------------------------------
		// 新版官网 数据返回接口
		// -------------------------------------------------------------------------------------------------------------------------

		// 常用服务返回数据
		List<OperatorCommonServiceNewRound> commonServiceNewRounds = operatorCommonServiceNewServiceInterface
				.selectAllOperatorCommonServiceNew(cityId);
		if (commonServiceNewRounds != null && commonServiceNewRounds.size() > 0) {
			for (OperatorCommonServiceNewRound operatorCommonServiceNewRound : commonServiceNewRounds) {
				List<OperatorCommonServiceDownNew> commonServiceDownNews = operatorCommonServiceNewRound
						.getOperatorCommonServiceDownNew();
				if (commonServiceDownNews != null && commonServiceDownNews.size() > 0) {
					for (OperatorCommonServiceDownNew operatorCommonServiceDownNew : commonServiceDownNews) {
						OperatorServerClass serverClass = operatorServerClassRepository
								.findOne(operatorCommonServiceDownNew.getServerTwoId());
						if (serverClass != null) {
							operatorCommonServiceDownNew.setServerName(serverClass.getServerName());
							operatorCommonServiceDownNew.setPcNavigation(serverClass.getPcNavigation());
						}

					}
				}

			}
		}

		reMap.put("commonServiceNewRounds", commonServiceNewRounds);

		// 租赁空间返回数据
		List<OperatorOfficeSpaceRo> operatorOfficeSpaceRosNew = new ArrayList<OperatorOfficeSpaceRo>();
		List<OperatorLeaseSpaceNew> leaseSpaceNews = operatorLeaseSpaceNewRepository
				.findOperatorLeaseSpaceNewByCityCode(cityId);
		OperatorOfficeSpaceRo officeSpaceRo = null;
		if (leaseSpaceNews != null && leaseSpaceNews.size() > 0) {
			for (OperatorLeaseSpaceNew operatorLeaseSpaceNew : leaseSpaceNews) {
				officeSpaceRo = new OperatorOfficeSpaceRo();
				ProvideRoom room = operatorRoomRepository.findByroomCodes(operatorLeaseSpaceNew.getSpaceNumber());
				if (room != null) {
					officeSpaceRo.setRoomCode(operatorLeaseSpaceNew.getSpaceNumber());
					officeSpaceRo.setPicture(room.getRoomlogo());
					officeSpaceRo.setDetailss(room.getDescribeAsk());
					officeSpaceRo.setRoomName(room.getRoomName());
					operatorOfficeSpaceRosNew.add(officeSpaceRo);
				}
			}
		}
		reMap.put("operatorOfficeSpaceRosNew", operatorOfficeSpaceRosNew);

		// 企业服务
		List<OperatorCompanyServiceVO> operatorCompanyServiceVOs = new ArrayList<>();
		List<OperatorCommodityRo> commodityRos = null;

		List<OperatorCompanyServiceNewRound> operatorCompanyServiceNewRounds = operatorCompanyServiceNewServiceInterface
				.findAllOperatorCompanyServiceNew(cityId);
		OperatorCompanyServiceVO companyServiceVO = null;
		if (operatorCompanyServiceNewRounds != null && operatorCompanyServiceNewRounds.size() > 0) {
			for (OperatorCompanyServiceNewRound operatorCompanyServiceNewRound : operatorCompanyServiceNewRounds) {
				companyServiceVO = new OperatorCompanyServiceVO();
				OperatorCompanyServiceNew companyServiceNew = operatorCompanyServiceNewRound
						.getOperatorCompanyServiceNew();
				if (companyServiceNew != null) {
					OperatorServerClass serverClass = operatorServerClassRepository
							.findOne(companyServiceNew.getServiceTwoId());
					if (serverClass != null) {
						companyServiceVO.setServerName(serverClass.getServerName());
						List<OperatorCompanyServiceDownNew> companyServiceDownNews = operatorCompanyServiceDownNewRepository
								.findCompanyServiceDownNewByCompanyServiceId(companyServiceNew.getId());
						commodityRos = new ArrayList<>();
						for (OperatorCompanyServiceDownNew operatorCompanyServiceDownNew : companyServiceDownNews) {
							if (operatorCompanyServiceDownNew.getCommodityNumber() != null
									&& !operatorCompanyServiceDownNew.getCommodityNumber().equals("")) {
								String jpql = "select new guoanmaker.operator.business.modelnobind.OperatorCommodityRo(p.id,p.commodityName,p.commodityPrice,p.commodity_smallimage,p.commodityState,p.createTime,p.releaseTime,b.businessName,s.serverName,p.salesVolume,p.reasoncontent,p.finalPrice,p.commodityCode,p.synopsis,p.isBargaining,p.startingPrice,p.isTerritoryRestriction)"
										+ "from ProvideCommodity p left join p.providerBusiness b  join p.serviceType s where 1=1 and p.commodityState=2 and p.commodityCode=:commodityCode ";
								Query query = manager.createQuery(jpql);
								query.setParameter("commodityCode",
										Integer.parseInt(operatorCompanyServiceDownNew.getCommodityNumber()));
								List<OperatorCommodityRo> operatorCommodityRos = query.getResultList();
								if (operatorCommodityRos != null && operatorCommodityRos.size() > 0) {
									OperatorCommodityRo commodityRo = operatorCommodityRos.get(0);
									if (commodityRo != null) {
										if (commodityRo.getIsTerritoryRestriction() != null
												&& commodityRo.getIsTerritoryRestriction().equals("1")) {
											List<ProvideCommodityServiceRange> comrang = provideCommodityServiceRangeRepository
													.selectBycitycodeandid(cityId, commodityRo.getId());
											if (comrang != null && comrang.size() >0) {
												commodityRo.setFinalPrice(comrang.get(0).getFinalPrice());
											} else {
												commodityRo.setFinalPrice(commodityRo.getFinalPrice());
											}
											
										}
									}
									commodityRos.add(commodityRo);
								}
							}
						}
						companyServiceVO.setCommodityRos(commodityRos);

						operatorCompanyServiceVOs.add(companyServiceVO);
					}
				}

			}

		}

		reMap.put("operatorCompanyServiceVOs", operatorCompanyServiceVOs);

		// 热门服务
		List<OperatorHotServerPc> hotServerPcs = operatorHotServerPcServiceIntegerface.getAllAndServerName(cityId);
		reMap.put("hotServerPcs", hotServerPcs);

		// 投融资服务
		List<OperatorFinancingServiceNewVO> financingServiceNewVOs = new ArrayList<>();
		List<OperatorFinancingServiceNew> financingPersonal = null;
		OperatorFinancingServiceNew operatorFinancingServicePersonal = null;
		OperatorFinancingServiceNewVO operatorFinancingServiceNewVOPersonal = null;
		financingPersonal = operatorFinancingServiceNewRepository.findByCitycodeAndFinancingName(cityId, "金融大咖");
		if (financingPersonal != null && financingPersonal.size() > 0) {
			operatorFinancingServicePersonal = financingPersonal.get(0);
			if (operatorFinancingServicePersonal != null) {
				operatorFinancingServiceNewVOPersonal = new OperatorFinancingServiceNewVO();
				operatorFinancingServiceNewVOPersonal.setOperatorFinancingServiceNew(operatorFinancingServicePersonal);
				List<OperatorFinancingServiceDownNew> financingServiceDownNews = operatorFinancingServiceDownNewRepository
						.findByFinancialServiceId(operatorFinancingServicePersonal.getId());
				if (financingServiceDownNews != null && financingServiceDownNews.size() > 0) {
					List<PersonalInvestorDisplay> personalInvestorDisplays = new ArrayList<>();
					PersonalInvestorDisplay personalInvestorDisplay = null;
					for (OperatorFinancingServiceDownNew operatorFinancingServiceDownNew : financingServiceDownNews) {
						personalInvestorDisplay = personalInvestorDisplayRepository
								.findOne(operatorFinancingServiceDownNew.getFinancialProjectId());
						personalInvestorDisplays.add(personalInvestorDisplay);
					}
					operatorFinancingServiceNewVOPersonal.setPersonalInvestorDisplays(personalInvestorDisplays);
				}
				financingServiceNewVOs.add(operatorFinancingServiceNewVOPersonal);
			}

		}
		List<OperatorFinancingServiceNew> financingProject = null;
		OperatorFinancingServiceNew operatorFinancingServiceProject = null;
		OperatorFinancingServiceNewVO operatorFinancingServiceNewVOProject = null;
		financingProject = operatorFinancingServiceNewRepository.findByCitycodeAndFinancingName(cityId, "推荐标的");
		if (financingProject != null && financingProject.size() > 0) {
			operatorFinancingServiceProject = financingProject.get(0);
			if (operatorFinancingServiceProject != null) {
				operatorFinancingServiceNewVOProject = new OperatorFinancingServiceNewVO();
				operatorFinancingServiceNewVOProject.setOperatorFinancingServiceNew(operatorFinancingServiceProject);
				List<PersonalFinanceProjectRo> personalFinanceProjects = new ArrayList<>();
				PersonalFinanceProject personalFinanceProject = null;
				List<OperatorFinancingServiceDownNew> financingServiceDownNews = operatorFinancingServiceDownNewRepository
						.findByFinancialServiceId(operatorFinancingServiceProject.getId());
				for (OperatorFinancingServiceDownNew operatorFinancingServiceDownNew : financingServiceDownNews) {
					personalFinanceProject = personalFinanceProjectRepository.findByFinanceProjectNumberAndStatus(
							operatorFinancingServiceDownNew.getFinancialProjectId(), 0);
					PersonalFinanceProjectRo financeProjectRo = null;
					if (personalFinanceProject != null) {
						financeProjectRo = new PersonalFinanceProjectRo();
						BeanUtils.copyProperties(personalFinanceProject, financeProjectRo);
						/*
						 * financeProjectRo = new PersonalFinanceProjectRo();
						 * financeProjectRo.setId(personalFinanceProject.getId()
						 * ); financeProjectRo.setFinanceProjectNumber(
						 * personalFinanceProject.getFinanceProjectNumber());
						 * financeProjectRo.setName(personalFinanceProject.
						 * getName()); financeProjectRo.setProjectPhoto(
						 * personalFinanceProject.getProjectPhoto());
						 * financeProjectRo.setRoundOfFinancing(
						 * personalFinanceProject.getRoundOfFinancing());
						 * financeProjectRo.setSellShares(personalFinanceProject
						 * .getSellShares());
						 * financeProjectRo.setSummary(personalFinanceProject.
						 * getSummary()); financeProjectRo.setFinancingTarget(
						 * personalFinanceProject.getFinancingTarget());
						 */
					}
					personalFinanceProjects.add(financeProjectRo);
				}
				operatorFinancingServiceNewVOProject.setPersonalFinanceProjects(personalFinanceProjects);
				financingServiceNewVOs.add(operatorFinancingServiceNewVOProject);
			}

		}

		reMap.put("financingServiceNewVOs", financingServiceNewVOs);
		return reMap;
	}

	public List<AppOutServerClass> selectOperatorServerClassList(String pcNavigation) {
		List<AppOutServerClass> apps = new ArrayList();
		List<OperatorServerClass> ServerClassList = operatorServerClassRepository.findListBypcNavigation(pcNavigation);
		for (OperatorServerClass ser : ServerClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			apps.add(appOutServerClass);
		}
		return apps;
	}

	public List<AppOutServerClass> selectOperatorServerClassListNoPra() {
		List<AppOutServerClass> apps = new ArrayList();
		List<OperatorServerClass> ServerClassList = operatorServerClassRepository.selectByOneServerclass();
		for (OperatorServerClass ser : ServerClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			apps.add(appOutServerClass);
		}
		return apps;
	}

	@Override
	public Map<String, Object> getNavigation(String cityId) {
		Map<String, Object> reMap = new HashMap<>();
		List<AppOutServerClass> appsBusinessService = new ArrayList();// 企业服务
		List<OperatorServerClass> ServerClassList = operatorServerClassRepository.findListBypcNavigation("1");
		for (OperatorServerClass ser : ServerClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			appsBusinessService.add(appOutServerClass);
		}
		reMap.put("appsBusinessService", appsBusinessService);
		List<AppOutServerClass> appsknowledgeService = new ArrayList();// 知识产权服务
		List<OperatorServerClass> ServerknowledgeClassList = operatorServerClassRepository.findListBypcNavigation("2");
		for (OperatorServerClass ser : ServerknowledgeClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			appsknowledgeService.add(appOutServerClass);
		}
		reMap.put("appsknowledgeService", appsknowledgeService);
		List<AppOutServerClass> appstrainService = new ArrayList();// 培训服务
		List<OperatorServerClass> ServertrainClassList = operatorServerClassRepository.findListBypcNavigation("3");
		for (OperatorServerClass ser : ServertrainClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			appstrainService.add(appOutServerClass);
		}
		reMap.put("appstrainService", appstrainService);
		List<AppOutServerClass> appsspaceService = new ArrayList();// 空间服务
		List<OperatorServerClass> ServerspaceClassList = operatorServerClassRepository.findListBypcNavigation("5");
		for (OperatorServerClass ser : ServerspaceClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			appsspaceService.add(appOutServerClass);
		}
		reMap.put("appsspaceService", appsspaceService);

		List<AppOutServerClass> appcollaborateService = new ArrayList();// 大企业合作
		List<OperatorServerClass> collaborateClassList = operatorServerClassRepository.findListBypcNavigation("4");
		for (OperatorServerClass ser : collaborateClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			appcollaborateService.add(appOutServerClass);
		}
		reMap.put("appcollaborateService", appcollaborateService);

		return reMap;
	}

	@Override
	public Map<String, Object> getService(String cityId) {
		Map<String, Object> reMap = new HashMap<>();
		OperatorHotwords operatorHotwords = operatorHotwordsRepository.findPcByCityCodeOne(cityId);
		reMap.put("hot", operatorHotwords);
		List<OperatorHotwords> hots = operatorHotwordsRepository.findPcByCityCodetwo(cityId);
		reMap.put("hots", hots);
		List<OperatorRoundPhoto> OperatorRoundPhotos = operatorRoundPhotoRepository.findBycityCode(cityId);
		reMap.put("OperatorRoundPhotos", OperatorRoundPhotos);
		List<OperatorFriendshipLink> friendshiplinks = operatorFriendshipLinkRepository.findByType("1");
		reMap.put("friendshiplinks", friendshiplinks);
		List<OperatorOfficeSpaceRo> OperatorOfficeSpaceRos = new ArrayList<OperatorOfficeSpaceRo>();
		List<OperatorOfficeSpace> officeSpaces = operatorOfficeSpaceRepository.getOperatorOfficeSpace(cityId);
		if (officeSpaces.size() > 0) {
			for (OperatorOfficeSpace office : officeSpaces) {
				OperatorOfficeSpaceRo ofro = new OperatorOfficeSpaceRo();
				ProvideRoom pr = operatorRoomRepository.findByroomCodes(office.getRoomCode());
				if (pr != null) {
					ofro.setRoomCode(office.getRoomCode());
					ofro.setPicture(pr.getRoomlogo());
					ofro.setDetailss(pr.getDescribeAsk());
					ofro.setRoomName(pr.getRoomName());
					OperatorOfficeSpaceRos.add(ofro);
				}
			}
		}
		reMap.put("OperatorOfficeSpaceRos", OperatorOfficeSpaceRos);
		// PC 热门商户
		List<OperatorHotBusiness> hotbusinessList = operatorHotBusinessRepository.getOperatorHotBusiness(cityId);
		List<HotBusinessVO> hotBusinessVOs = new ArrayList<>();
		for (OperatorHotBusiness operatorHotBusiness : hotbusinessList) {
			String jpql = "select new guoanmaker.operator.business.modelnobind.HotBusinessVO(b.id,b.companyLogo,b.businessName,b.introduce,p.followNum) from "
					+ "ProvideShop  p left join p.providerBusiness b inner join b.personalUser u where u.isProvider=2 and  b.busNumber =:busNumber";
			Query query = manager.createQuery(jpql);
			query.setParameter("busNumber", operatorHotBusiness.getBusNumber());
			List<HotBusinessVO> businesss = query.getResultList();
			if (businesss != null && businesss.size() > 0) {
				HotBusinessVO hotBusinessVO = businesss.get(0);
				// hotBusinessVO.setBusinesspicture(operatorHotBusiness.getBusPicture());
				hotBusinessVOs.add(hotBusinessVO);
			}
		}
		reMap.put("hotBusinessVOs", hotBusinessVOs);

		// 常用服务返回数据
		List<OperatorCommonServiceNewRound> commonServiceNewRounds = operatorCommonServiceNewServiceInterface
				.selectAllOperatorCommonServiceNew(cityId);
		if (commonServiceNewRounds != null && commonServiceNewRounds.size() > 0) {
			for (OperatorCommonServiceNewRound operatorCommonServiceNewRound : commonServiceNewRounds) {
				List<OperatorCommonServiceDownNew> commonServiceDownNews = operatorCommonServiceNewRound
						.getOperatorCommonServiceDownNew();
				if (commonServiceDownNews != null && commonServiceDownNews.size() > 0) {
					for (OperatorCommonServiceDownNew operatorCommonServiceDownNew : commonServiceDownNews) {
						OperatorServerClass serverClass = operatorServerClassRepository
								.findOne(operatorCommonServiceDownNew.getServerTwoId());
						if (serverClass != null) {
							operatorCommonServiceDownNew.setServerName(serverClass.getServerName());
							operatorCommonServiceDownNew.setPcNavigation(serverClass.getPcNavigation());
						}

					}
				}

			}
		}

		reMap.put("commonServiceNewRounds", commonServiceNewRounds);

		// 租赁空间返回数据
		List<OperatorOfficeSpaceRo> operatorOfficeSpaceRosNew = new ArrayList<OperatorOfficeSpaceRo>();
		List<OperatorLeaseSpaceNew> leaseSpaceNews = operatorLeaseSpaceNewRepository
				.findOperatorLeaseSpaceNewByCityCode(cityId);
		OperatorOfficeSpaceRo officeSpaceRo = null;
		if (leaseSpaceNews != null && leaseSpaceNews.size() > 0) {
			for (OperatorLeaseSpaceNew operatorLeaseSpaceNew : leaseSpaceNews) {
				officeSpaceRo = new OperatorOfficeSpaceRo();
				ProvideRoom room = operatorRoomRepository.findByroomCodes(operatorLeaseSpaceNew.getSpaceNumber());
				if (room != null) {
					officeSpaceRo.setRoomCode(operatorLeaseSpaceNew.getSpaceNumber());
					officeSpaceRo.setPicture(room.getRoomlogo());
					officeSpaceRo.setDetailss(room.getDescribeAsk());
					officeSpaceRo.setRoomName(room.getRoomName());
					operatorOfficeSpaceRosNew.add(officeSpaceRo);
				}
			}
		}
		reMap.put("operatorOfficeSpaceRosNew", operatorOfficeSpaceRosNew);

		// 企业服务
		List<OperatorCompanyServiceVO> operatorCompanyServiceVOs = new ArrayList<>();
		List<OperatorCommodityRo> commodityRos = null;

		List<OperatorCompanyServiceNewRound> operatorCompanyServiceNewRounds = operatorCompanyServiceNewServiceInterface
				.findAllOperatorCompanyServiceNew(cityId);
		OperatorCompanyServiceVO companyServiceVO = null;
		if (operatorCompanyServiceNewRounds != null && operatorCompanyServiceNewRounds.size() > 0) {
			for (OperatorCompanyServiceNewRound operatorCompanyServiceNewRound : operatorCompanyServiceNewRounds) {
				companyServiceVO = new OperatorCompanyServiceVO();
				OperatorCompanyServiceNew companyServiceNew = operatorCompanyServiceNewRound
						.getOperatorCompanyServiceNew();
				if (companyServiceNew != null) {
					OperatorServerClass serverClass = operatorServerClassRepository
							.findOne(companyServiceNew.getServiceTwoId());
					if (serverClass != null) {
						companyServiceVO.setServerName(serverClass.getServerName());
						List<OperatorCompanyServiceDownNew> companyServiceDownNews = operatorCompanyServiceDownNewRepository
								.findCompanyServiceDownNewByCompanyServiceId(companyServiceNew.getId());
						commodityRos = new ArrayList<>();
						for (OperatorCompanyServiceDownNew operatorCompanyServiceDownNew : companyServiceDownNews) {
							if (operatorCompanyServiceDownNew.getCommodityNumber() != null
									&& !operatorCompanyServiceDownNew.getCommodityNumber().equals("")) {
								String jpql = "select new guoanmaker.operator.business.modelnobind.OperatorCommodityRo(p.id,p.commodityName,p.commodityPrice,p.commodity_smallimage,p.commodityState,p.createTime,p.releaseTime,b.businessName,s.serverName,p.salesVolume,p.reasoncontent,p.finalPrice,p.commodityCode,p.synopsis,p.isBargaining,p.startingPrice,p.isTerritoryRestriction)"
										+ "from ProvideCommodity p left join p.providerBusiness b  join p.serviceType s where 1=1 and p.commodityState=2 and p.commodityCode=:commodityCode ";
								Query query = manager.createQuery(jpql);
								query.setParameter("commodityCode",
										Integer.parseInt(operatorCompanyServiceDownNew.getCommodityNumber()));
								List<OperatorCommodityRo> operatorCommodityRos = query.getResultList();
								if (operatorCommodityRos != null && operatorCommodityRos.size() > 0) {
									OperatorCommodityRo commodityRo = operatorCommodityRos.get(0);
									if (commodityRo != null) {
										if (commodityRo.getIsTerritoryRestriction() != null
												&& commodityRo.getIsTerritoryRestriction().equals("1")) {
											List<ProvideCommodityServiceRange> comrang = provideCommodityServiceRangeRepository
													.selectBycitycodeandid(cityId, commodityRo.getId());
											if (comrang != null && comrang.size() >0) {
												commodityRo.setFinalPrice(comrang.get(0).getFinalPrice());
											} else {
												commodityRo.setFinalPrice(commodityRo.getFinalPrice());
											}
										}
									}
									commodityRos.add(commodityRo);
								}
							}
						}
						companyServiceVO.setCommodityRos(commodityRos);

						operatorCompanyServiceVOs.add(companyServiceVO);
					}
				}

			}

		}

		reMap.put("operatorCompanyServiceVOs", operatorCompanyServiceVOs);

		// 热门服务
		List<OperatorHotServerPc> hotServerPcs = operatorHotServerPcServiceIntegerface.getAllAndServerName(cityId);
		reMap.put("hotServerPcs", hotServerPcs);

		// 投融资服务
		List<OperatorFinancingServiceNewVO> financingServiceNewVOs = new ArrayList<>();
		List<OperatorFinancingServiceNew> financingPersonal = null;
		OperatorFinancingServiceNew operatorFinancingServicePersonal = null;
		OperatorFinancingServiceNewVO operatorFinancingServiceNewVOPersonal = null;
		financingPersonal = operatorFinancingServiceNewRepository.findByCitycodeAndFinancingName(cityId, "金融大咖");
		if (financingPersonal != null && financingPersonal.size() > 0) {
			operatorFinancingServicePersonal = financingPersonal.get(0);
			if (operatorFinancingServicePersonal != null) {
				operatorFinancingServiceNewVOPersonal = new OperatorFinancingServiceNewVO();
				operatorFinancingServiceNewVOPersonal.setOperatorFinancingServiceNew(operatorFinancingServicePersonal);
				List<OperatorFinancingServiceDownNew> financingServiceDownNews = operatorFinancingServiceDownNewRepository
						.findByFinancialServiceId(operatorFinancingServicePersonal.getId());
				if (financingServiceDownNews != null && financingServiceDownNews.size() > 0) {
					List<PersonalInvestorDisplay> personalInvestorDisplays = new ArrayList<>();
					PersonalInvestorDisplay personalInvestorDisplay = null;
					for (OperatorFinancingServiceDownNew operatorFinancingServiceDownNew : financingServiceDownNews) {
						personalInvestorDisplay = personalInvestorDisplayRepository
								.findOne(operatorFinancingServiceDownNew.getFinancialProjectId());
						personalInvestorDisplays.add(personalInvestorDisplay);
					}
					operatorFinancingServiceNewVOPersonal.setPersonalInvestorDisplays(personalInvestorDisplays);
				}
				financingServiceNewVOs.add(operatorFinancingServiceNewVOPersonal);
			}

		}
		List<OperatorFinancingServiceNew> financingProject = null;
		OperatorFinancingServiceNew operatorFinancingServiceProject = null;
		OperatorFinancingServiceNewVO operatorFinancingServiceNewVOProject = null;
		financingProject = operatorFinancingServiceNewRepository.findByCitycodeAndFinancingName(cityId, "推荐标的");
		if (financingProject != null && financingProject.size() > 0) {
			operatorFinancingServiceProject = financingProject.get(0);
			if (operatorFinancingServiceProject != null) {
				operatorFinancingServiceNewVOProject = new OperatorFinancingServiceNewVO();
				operatorFinancingServiceNewVOProject.setOperatorFinancingServiceNew(operatorFinancingServiceProject);
				List<PersonalFinanceProjectRo> personalFinanceProjects = new ArrayList<>();
				PersonalFinanceProject personalFinanceProject = null;
				List<OperatorFinancingServiceDownNew> financingServiceDownNews = operatorFinancingServiceDownNewRepository
						.findByFinancialServiceId(operatorFinancingServiceProject.getId());
				for (OperatorFinancingServiceDownNew operatorFinancingServiceDownNew : financingServiceDownNews) {
					personalFinanceProject = personalFinanceProjectRepository.findByFinanceProjectNumberAndStatus(
							operatorFinancingServiceDownNew.getFinancialProjectId(), 0);
					PersonalFinanceProjectRo financeProjectRo = null;
					if (personalFinanceProject != null) {
						financeProjectRo = new PersonalFinanceProjectRo();
						BeanUtils.copyProperties(personalFinanceProject, financeProjectRo);
						/*
						 * financeProjectRo = new PersonalFinanceProjectRo();
						 * financeProjectRo.setId(personalFinanceProject.getId()
						 * ); financeProjectRo.setFinanceProjectNumber(
						 * personalFinanceProject.getFinanceProjectNumber());
						 * financeProjectRo.setName(personalFinanceProject.
						 * getName()); financeProjectRo.setProjectPhoto(
						 * personalFinanceProject.getProjectPhoto());
						 * financeProjectRo.setRoundOfFinancing(
						 * personalFinanceProject.getRoundOfFinancing());
						 * financeProjectRo.setSellShares(personalFinanceProject
						 * .getSellShares());
						 * financeProjectRo.setSummary(personalFinanceProject.
						 * getSummary()); financeProjectRo.setFinancingTarget(
						 * personalFinanceProject.getFinancingTarget());
						 */
					}
					personalFinanceProjects.add(financeProjectRo);
				}
				operatorFinancingServiceNewVOProject.setPersonalFinanceProjects(personalFinanceProjects);
				financingServiceNewVOs.add(operatorFinancingServiceNewVOProject);
			}

		}

		reMap.put("financingServiceNewVOs", financingServiceNewVOs);
		return reMap;
	}

	@Override
	public Map<String, Object> getPc(String cityId) {
		Map<String, Object> reMap = new HashMap<>();
		// 搜索栏
		OperatorHotwords operatorHotwords = operatorHotwordsRepository.findPcByCityCodeOne(cityId);
		reMap.put("hot", operatorHotwords);
		List<OperatorHotwords> hots = operatorHotwordsRepository.findPcByCityCodetwo(cityId);
		reMap.put("hots", hots);
		// 轮播图
		List<OperatorRoundPhoto> OperatorRoundPhotos = operatorRoundPhotoRepository.findBycityCode(cityId);
		reMap.put("OperatorRoundPhotos", OperatorRoundPhotos);

		// PC 热门商户
		List<OperatorHotBusiness> hotbusinessList = operatorHotBusinessRepository.getOperatorHotBusiness(cityId);
		List<HotBusinessVO> hotBusinessVOs = new ArrayList<>();
		if (hotbusinessList != null && hotbusinessList.size() >0) {
			for (OperatorHotBusiness operatorHotBusiness : hotbusinessList) {
				String jpql = "select new guoanmaker.operator.business.modelnobind.HotBusinessVO(b.id,b.companyLogo,b.businessName,b.introduce,p.followNum) from "
						+ "ProvideShop  p left join p.providerBusiness b inner join b.personalUser u where u.isProvider=2 and  b.busNumber =:busNumber";
				Query query = manager.createQuery(jpql);
				query.setParameter("busNumber", operatorHotBusiness.getBusNumber());
				List<HotBusinessVO> businesss = query.getResultList();
				if (businesss != null && businesss.size() > 0) {
					HotBusinessVO hotBusinessVO = businesss.get(0);
					// hotBusinessVO.setBusinesspicture(operatorHotBusiness.getBusPicture());
					hotBusinessVOs.add(hotBusinessVO);
				}
			}
			
		}
		
		reMap.put("hotBusinessVOs", hotBusinessVOs);

		List<OperatorFriendshipLink> friendshiplinks = operatorFriendshipLinkRepository.findByType("1");
		reMap.put("friendshiplinks", friendshiplinks);
		List<AppOutServerClass> appsBusinessService = new ArrayList();// 企业服务
		List<OperatorServerClass> ServerClassList = operatorServerClassRepository.findListBypcNavigation("1");
		for (OperatorServerClass ser : ServerClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			appsBusinessService.add(appOutServerClass);
		}
		reMap.put("appsBusinessService", appsBusinessService);
		List<AppOutServerClass> appsknowledgeService = new ArrayList();// 知识产权服务
		List<OperatorServerClass> ServerknowledgeClassList = operatorServerClassRepository.findListBypcNavigation("2");
		for (OperatorServerClass ser : ServerknowledgeClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			appsknowledgeService.add(appOutServerClass);
		}
		reMap.put("appsknowledgeService", appsknowledgeService);
		List<AppOutServerClass> appstrainService = new ArrayList();// 培训服务
		List<OperatorServerClass> ServertrainClassList = operatorServerClassRepository.findListBypcNavigation("3");
		for (OperatorServerClass ser : ServertrainClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			appstrainService.add(appOutServerClass);
		}
		reMap.put("appstrainService", appstrainService);
		List<AppOutServerClass> appsspaceService = new ArrayList();// 空间服务
		List<OperatorServerClass> ServerspaceClassList = operatorServerClassRepository.findListBypcNavigation("5");
		for (OperatorServerClass ser : ServerspaceClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			appsspaceService.add(appOutServerClass);
		}
		reMap.put("appsspaceService", appsspaceService);

		List<AppOutServerClass> appcollaborateService = new ArrayList();// 大企业合作
		List<OperatorServerClass> collaborateClassList = operatorServerClassRepository.findListBypcNavigation("4");
		for (OperatorServerClass ser : collaborateClassList) {
			AppOutServerClass appOutServerClass = new AppOutServerClass();
			List<OperatorServerClass> serclasses = operatorServerClassRepository.findByParentServerId(ser.getId());// 二级
			appOutServerClass.setOperatorServerClass(ser);
			if (serclasses.size() > 0) {
				List<PctwoServerClass> pcs = new ArrayList();
				for (OperatorServerClass sertwoclass : serclasses) {
					PctwoServerClass pctwoServerClass = new PctwoServerClass();
					List<OperatorServerClass> serthrees = operatorServerClassRepository
							.findByParentServerId(sertwoclass.getId());
					pctwoServerClass.setOperatorSerTwo(sertwoclass);
					if (serthrees.size() > 0) {
						pctwoServerClass.setServerClasThree(serthrees);
					}
					pcs.add(pctwoServerClass);
				}
				appOutServerClass.setServerClasTwo(pcs);
			}
			appcollaborateService.add(appOutServerClass);
		}
		reMap.put("appcollaborateService", appcollaborateService);

		/*以下为新版官网首页接口*/ 

		// 常用服务返回数据
		List<OperatorCommonServiceNewRound> commonServiceNewRounds = operatorCommonServiceNewServiceInterface
				.selectAllOperatorCommonServiceNew(cityId);
		
		if (commonServiceNewRounds != null && commonServiceNewRounds.size() > 0) {
			for (OperatorCommonServiceNewRound operatorCommonServiceNewRound : commonServiceNewRounds) {
				List<OperatorCommonServiceDownNew> commonServiceDownNews = operatorCommonServiceNewRound
						.getOperatorCommonServiceDownNew();
				if (commonServiceDownNews != null && commonServiceDownNews.size() > 0) {
					for (OperatorCommonServiceDownNew operatorCommonServiceDownNew : commonServiceDownNews) {
						OperatorServerClass serverClass = operatorServerClassRepository
								.findOne(operatorCommonServiceDownNew.getServerTwoId());
						if (serverClass != null) {
							operatorCommonServiceDownNew.setServerName(serverClass.getServerName());
							operatorCommonServiceDownNew.setPcNavigation(serverClass.getPcNavigation());
						}

					}
				}

			}
		}

		reMap.put("commonServiceNewRounds", commonServiceNewRounds);

		// 租赁空间返回数据
		List<OperatorOfficeSpaceRo> operatorOfficeSpaceRosNew = new ArrayList<OperatorOfficeSpaceRo>();
		List<OperatorLeaseSpaceNew> leaseSpaceNews = operatorLeaseSpaceNewRepository
				.findOperatorLeaseSpaceNewByCityCode(cityId);
		
		OperatorOfficeSpaceRo officeSpaceRo = null;
		if (leaseSpaceNews != null && leaseSpaceNews.size() > 0) {
			for (OperatorLeaseSpaceNew operatorLeaseSpaceNew : leaseSpaceNews) {
				officeSpaceRo = new OperatorOfficeSpaceRo();
				ProvideRoom room = operatorRoomRepository.findByroomCodes(operatorLeaseSpaceNew.getSpaceNumber());
				if (room != null) {
					officeSpaceRo.setRoomCode(operatorLeaseSpaceNew.getSpaceNumber());
					officeSpaceRo.setPicture(room.getRoomlogo());
					officeSpaceRo.setDetailss(room.getDescribeAsk());
					officeSpaceRo.setRoomName(room.getRoomName());
					operatorOfficeSpaceRosNew.add(officeSpaceRo);
				}
			}
		}
		reMap.put("operatorOfficeSpaceRosNew", operatorOfficeSpaceRosNew);

		// 企业服务
		List<OperatorCompanyServiceVO> operatorCompanyServiceVOs = new ArrayList<>();
		List<OperatorCommodityRo> commodityRos = null;

		List<OperatorCompanyServiceNewRound> operatorCompanyServiceNewRounds = operatorCompanyServiceNewServiceInterface
				.findAllOperatorCompanyServiceNew(cityId);
		OperatorCompanyServiceVO companyServiceVO = null;
		if (operatorCompanyServiceNewRounds != null && operatorCompanyServiceNewRounds.size() > 0) {
			for (OperatorCompanyServiceNewRound operatorCompanyServiceNewRound : operatorCompanyServiceNewRounds) {
				companyServiceVO = new OperatorCompanyServiceVO();
				OperatorCompanyServiceNew companyServiceNew = operatorCompanyServiceNewRound
						.getOperatorCompanyServiceNew();
				if (companyServiceNew != null) {
					OperatorServerClass serverClass = operatorServerClassRepository
							.findOne(companyServiceNew.getServiceTwoId());
					if (serverClass != null) {
						companyServiceVO.setServerName(serverClass.getServerName());
						List<OperatorCompanyServiceDownNew> companyServiceDownNews = operatorCompanyServiceDownNewRepository
								.findCompanyServiceDownNewByCompanyServiceId(companyServiceNew.getId());
						commodityRos = new ArrayList<>();
						for (OperatorCompanyServiceDownNew operatorCompanyServiceDownNew : companyServiceDownNews) {
							if (operatorCompanyServiceDownNew.getCommodityNumber() != null
									&& !operatorCompanyServiceDownNew.getCommodityNumber().equals("")) {
								String jpql = "select new guoanmaker.operator.business.modelnobind.OperatorCommodityRo(p.id,p.commodityName,p.commodityPrice,p.commodity_smallimage,p.commodityState,p.createTime,p.releaseTime,b.businessName,s.serverName,p.salesVolume,p.reasoncontent,p.finalPrice,p.commodityCode,p.synopsis,p.isBargaining,p.startingPrice,p.isTerritoryRestriction)"
										+ "from ProvideCommodity p left join p.providerBusiness b  join p.serviceType s where 1=1 and p.commodityState=2 and p.commodityCode=:commodityCode ";
								Query query = manager.createQuery(jpql);
								query.setParameter("commodityCode",
										Integer.parseInt(operatorCompanyServiceDownNew.getCommodityNumber()));
								List<OperatorCommodityRo> operatorCommodityRos = query.getResultList();
								if (operatorCommodityRos != null && operatorCommodityRos.size() > 0) {
									OperatorCommodityRo commodityRo = operatorCommodityRos.get(0);
									if (commodityRo != null) {
										if (commodityRo.getIsTerritoryRestriction() != null
												&& commodityRo.getIsTerritoryRestriction().equals("1")) {
											List<ProvideCommodityServiceRange> comrang = provideCommodityServiceRangeRepository
													.selectBycitycodeandid(cityId, commodityRo.getId());
											if (comrang != null && comrang.size() >0) {
												commodityRo.setFinalPrice(comrang.get(0).getFinalPrice());
											} else {
												commodityRo.setFinalPrice(commodityRo.getFinalPrice());
											}
											
										}
									}
									commodityRos.add(commodityRo);
								}
							}
						}
						companyServiceVO.setCommodityRos(commodityRos);

						operatorCompanyServiceVOs.add(companyServiceVO);
					}
				}

			}

		}

		reMap.put("operatorCompanyServiceVOs", operatorCompanyServiceVOs);

		// 热门服务
		List<OperatorHotServerPc> hotServerPcs = operatorHotServerPcServiceIntegerface.getAllAndServerName(cityId);
		reMap.put("hotServerPcs", hotServerPcs);

		// 投融资服务
		List<OperatorFinancingServiceNewVO> financingServiceNewVOs = new ArrayList<>();
		List<OperatorFinancingServiceNew> financingPersonal = null;
		OperatorFinancingServiceNew operatorFinancingServicePersonal = null;
		OperatorFinancingServiceNewVO operatorFinancingServiceNewVOPersonal = null;
		financingPersonal = operatorFinancingServiceNewRepository.findByCitycodeAndFinancingName(cityId, "金融大咖");
		if (financingPersonal != null && financingPersonal.size() > 0) {
			operatorFinancingServicePersonal = financingPersonal.get(0);
			if (operatorFinancingServicePersonal != null) {
				operatorFinancingServiceNewVOPersonal = new OperatorFinancingServiceNewVO();
				operatorFinancingServiceNewVOPersonal.setOperatorFinancingServiceNew(operatorFinancingServicePersonal);
				List<OperatorFinancingServiceDownNew> financingServiceDownNews = operatorFinancingServiceDownNewRepository
						.findByFinancialServiceId(operatorFinancingServicePersonal.getId());
				if (financingServiceDownNews != null && financingServiceDownNews.size() > 0) {
					List<PersonalInvestorDisplay> personalInvestorDisplays = new ArrayList<>();
					PersonalInvestorDisplay personalInvestorDisplay = null;
					for (OperatorFinancingServiceDownNew operatorFinancingServiceDownNew : financingServiceDownNews) {
						personalInvestorDisplay = personalInvestorDisplayRepository
								.findOne(operatorFinancingServiceDownNew.getFinancialProjectId());
						personalInvestorDisplays.add(personalInvestorDisplay);
					}
					operatorFinancingServiceNewVOPersonal.setPersonalInvestorDisplays(personalInvestorDisplays);
				}
				financingServiceNewVOs.add(operatorFinancingServiceNewVOPersonal);
			}

		}
		List<OperatorFinancingServiceNew> financingProject = null;
		OperatorFinancingServiceNew operatorFinancingServiceProject = null;
		OperatorFinancingServiceNewVO operatorFinancingServiceNewVOProject = null;
		financingProject = operatorFinancingServiceNewRepository.findByCitycodeAndFinancingName(cityId, "推荐标的");
		if (financingProject != null && financingProject.size() > 0) {
			operatorFinancingServiceProject = financingProject.get(0);
			if (operatorFinancingServiceProject != null) {
				operatorFinancingServiceNewVOProject = new OperatorFinancingServiceNewVO();
				operatorFinancingServiceNewVOProject.setOperatorFinancingServiceNew(operatorFinancingServiceProject);
				List<PersonalFinanceProjectRo> personalFinanceProjects = new ArrayList<>();
				PersonalFinanceProject personalFinanceProject = null;
				List<OperatorFinancingServiceDownNew> financingServiceDownNews = operatorFinancingServiceDownNewRepository
						.findByFinancialServiceId(operatorFinancingServiceProject.getId());
				for (OperatorFinancingServiceDownNew operatorFinancingServiceDownNew : financingServiceDownNews) {
					personalFinanceProject = personalFinanceProjectRepository.findByFinanceProjectNumberAndStatus(
							operatorFinancingServiceDownNew.getFinancialProjectId(), 0);
					PersonalFinanceProjectRo financeProjectRo = null;
					if (personalFinanceProject != null) {
						financeProjectRo = new PersonalFinanceProjectRo();
						BeanUtils.copyProperties(personalFinanceProject, financeProjectRo);
					}
					personalFinanceProjects.add(financeProjectRo);
				}
				operatorFinancingServiceNewVOProject.setPersonalFinanceProjects(personalFinanceProjects);
				financingServiceNewVOs.add(operatorFinancingServiceNewVOProject);
			}

		}

		reMap.put("financingServiceNewVOs", financingServiceNewVOs);
		
		return reMap;
	}


}
